package com.example.consumer3;

import com.example.common.TestService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <b>TODO . </b>
 *
 * @author yangyl11
 * @version 1.0.0
 * @date 2020/11/9
 * @since JDK 1.8
 */
@RestController
public class TestController {

	private Logger logger = LoggerFactory.getLogger(TestController.class);

	@DubboReference
	TestService testService;

	@Resource
	FeignService feignService;

	@Resource
	Feign2DubboService feign2DubboService;

	@RequestMapping("/test1")
	public String testDubbo() {

		logger.info("testDubbo");
		return testService.test("testDubbo");
	}

	@RequestMapping("/test2")
	public String testFeign() {

		logger.info("testFeign");
		return feignService.testRest("testFeign");
	}

	@RequestMapping("/test3")
	public String feign2Dubbo() {

		logger.info("feign2Dubbo");
		return feign2DubboService.testRest("feign2Dubbo");
	}
}
